<?
include('seguridad.php');
include('bd.php');
Conectar();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> BideYoday </TITLE>
  <META NAME="Generator" CONTENT="DILAPER">
  <META NAME="Author" CONTENT="Power by Sebastian Costa - Design: Nadia De Cinti">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <link href="../style.css" rel="stylesheet" type="text/css">
  <script src="../js/botonera.js" type="text/javascript"></script>
 </HEAD>

 <BODY topmargin="0">
<center>
<table width="990" height="100%" cellspacing="0" cellpadding="0" class="fondo" border="0">
	<tr>
		<td width="100%" height="100%" align="center" valign="top">
			<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td align="center" valign="top">
<div style="height: 135px"></div>
<!-- contenido -->
<table width="800"  border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr bgcolor="#ffffff">
		<td align="right" height="30">
Welcome <?echo $_SESSION['usuario'];?>&nbsp;|&nbsp;<a href="salir.php"><font color="red">Log Out</font></a>&nbsp;&nbsp;
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="right" height="50">
<?include('menu.php');?>
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="left" valign="top" height="300"  class="tabla_central">
<div style="margin: 10px">
<b><span class="titulo_admin">Orders</span></b><br>
<br>
<table width="800" border="0">
	<tr>
		<td width="350" valign="top">
<b>Date of client</b><br>
<br>
<?
$result_d= mysql_query("SELECT * FROM clientes_datos WHERE codigo_pedido='".$_GET[code]."'"); 
while($row_d = mysql_fetch_array($result_d, MYSQL_ASSOC)){
?>
	<table border="0">
		<tr>
			<td align="right">
Code:&nbsp;
			</td>
			<td>
<b><?echo$row_d[codigo_pedido];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
First Name:&nbsp;
			</td>
			<td>
<b><?echo$row_d[nombre];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Last Name:&nbsp;
			</td>
			<td>
<b><?echo$row_d[apellido];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Address 1:&nbsp;
			</td>
			<td>
<b><?echo$row_d[address_1];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Address 2:&nbsp;
			</td>
			<td>
<b><?echo$row_d[address_2];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
City:&nbsp;
			</td>
			<td>
<b><?echo$row_d[city];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
State:&nbsp;
			</td>
			<td>
<b><?echo$row_d[state];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Code State:&nbsp;
			</td>
			<td>
<b><?echo$row_d[state_code];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Zip:&nbsp;
			</td>
			<td>
<b><?echo$row_d[zip];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Phone:&nbsp;
			</td>
			<td>
<b><?echo$row_d[phone];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Alt Phone:&nbsp;
			</td>
			<td>
<b><?echo$row_d[alt_phone];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Email:&nbsp;
			</td>
			<td>
<b><?echo$row_d[email];?></b>
			</td>
		</tr>
	</table>
<?}?><br>
<hr ><br>
<b>Date of buy</b><br>
<br>
<?
$result_d= mysql_query("SELECT * FROM carrito_close WHERE codigo_pedido='".$_GET[code]."'"); 
while($row_d = mysql_fetch_array($result_d, MYSQL_ASSOC)){
?>
	<table border="0">
		<tr>
			<td align="right">
Code:&nbsp;
			</td>
			<td>
<b><?echo$row_d[codigo_pedido];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Date:&nbsp;
			</td>
			<td>
<b><?echo$row_d[fecha_pedido];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Tax:&nbsp;
			</td>
			<td>
<b>$<?echo$row_d[tax];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Cost of sending:&nbsp;
			</td>
			<td>
<b>$<?echo$row_d[costo_envio];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Total:&nbsp;
			</td>
			<td>
<b><?echo$row_d[total];?></b>
			</td>
		</tr>
		<tr>
			<td align="right">
Condition:&nbsp;
			</td>
			<td>
<b><?echo$row_d[estado];?></b>
			</td>
		</tr>
	</table>
<?}?>	
		</td>
		<td width="450" valign="top">
<b>List of products</b><br>
<br>
<!-- pedido ------------------------------------------------------------------------------------------------------------- -->
<table width="490" border="0" cellspacing="0" cellpadding="0" class="tabla_productos">
	<tr>
		<td width="25%" height="20" align="center">
<div style="margin-bottom: 1px;">Item</div>
		</td>
		<td width="25%" align="center">
<div style="margin-bottom: 1px;">Unit Price</div>
		</td>
		<td width="25%" align="center">
<div style="margin-bottom: 1px;">Data</div>
		</td>
		<td width="25%" align="center">
<div style="margin-bottom: 1px;">Total</div>
		</td>
	</tr>
</table>
<table width="480" border="0" cellspacing="0" cellpadding="0" class="txt_productos" bgcolor="#ffffff" style="border: 1px solid #000000; border-top: 0px;">
	<tr><td colspan="4" height="20"></td></tr>
<?
$cuantos='0';
$result=mysql_query("SELECT * FROM carrito WHERE codigo_pedido='".$_GET[code]."'");
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
?>
	<tr>
		<td width="25%" height="30" align="center" style="border-right: 1px solid #000000;">
<?if(file_exists('../img_products/'.$row[code].'-1_c.jpg')){?>
<img src="../img_products/<?echo $row[code]?>-1_c.jpg"><br><?}?>
<?echo$row[nombre];?><br>
<?echo$row[modelo];?><br>
		</td>
		<td width="25%" align="center" style="border-right: 1px solid #000000;">
<?
$price_d= substr($row[precio], 0, strlen($row[precio]) -2);
$price_c= substr($row[precio], -2, 2);
?>
<b>$<?echo$price_d.'.'.$price_c?></b><br>
		</td>
		<td width="25%" align="left" style="border-right: 1px solid #000000;">
<div style="margin-left: 5px">
QTY:&nbsp;&nbsp;<?echo$row[cantidad];?><br>
Shape:&nbsp;&nbsp;<?echo$row[forma];?><br>
Color:&nbsp;&nbsp;<?echo$row[color];?><br></div>
		</td>
		<td width="25%" align="center">
<?
$total=($row[precio]*$row[cantidad]);
$total_t=$total_t+$total;
?>
<?
$total_d= substr($total, 0, strlen($total) -2);
$total_c= substr($total, -2, 2);
?>
<b>$<?echo$total_d.'.'.$total_c;?></b><br>
		</td>
	</tr>
	<tr><td colspan="4" height="20"></td></tr>
<?$cuantos++;}?>
</table>
<table width="490" border="0" cellspacing="0" cellpadding="0" class="tabla_productos">
	<tr>
		<td width="25%" height="20" align="right">
<?
$total_t_d= substr($total_t, 0, strlen($total_t) -2);
$total_t_c= substr($total_t, -2, 2);
$_SESSION[subtotal]=$total_t_d.'.'.$total_t_c;
$_SESSION[cuantos]=$cuantos;
?>
<div style="margin-bottom: 2px; margin-right: 50px;"><b>$<?echo$total_t_d.'.'.$total_t_c;?></b></div>
		</td>
	</tr>
</table>
<!-- fin pedido ------------------------------------------------------------------------------------------------------------- -->
<br>
		</td>
	</tr>
</table>
<br>
</div>
<br>
		</td>
	</tr>
</table>
<table width="800" border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr>
		<td height="3">

		</td>
	</tr>
	<tr bgcolor="#ffffff">
		<td align="right">
Area of administration of contendios of the web bidetoday.com &nbsp;&nbsp;&nbsp;
		</td>
	</tr>
</table>
<!-- fin contenido -->
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</center>
 </BODY>
</HTML>
<?Desconectar();?>